package com.ruoyi.report.mapper;

import com.ruoyi.report.domain.SysReport;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-07-12
 */
public interface SysReportMapper extends BaseMapper<SysReport> {

    @Select("select id,order_id as orderId,status,result,url,create_by as createBy" +
            ",create_time as createTime,update_by as updateBy,update_time as updateTime," +
            "remark,user_id as userId,dept_id as deptId,report_no as reportNo from sys_report where order_id = #{orderId}")
    List<SysReport> selectListByOrderId(Long orderId);


    void insertSysReport(SysReport sysReport);

    @Select("select id,order_id as orderId,status,result,url,create_by as createBy" +
            ",create_time as createTime,update_by as updateBy,update_time as updateTime," +
            "remark,user_id as userId,dept_id as deptId,report_no as reportNo from sys_report where order_id = #{orderId} and status = 1 order by create_time desc ")
    List<SysReport> selectDwonListByOrderId(Long orderId);

    List<SysReport> selectSysReportByOrderIds(@Param("orderIds") List<Long> orderIds);
}
